# This file is part of BlackArch ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=smtp-user-enum
pkgver=1.2
pkgrel=7
groups=('blackarch' 'blackarch-recon' 'blackarch-scanner')
pkgdesc='Username guessing tool primarily for use against the default Solaris SMTP service. Can use either EXPN, VRFY or RCPT TO.'
url='https://pentestmonkey.net/tools/user-enumeration/smtp-user-enum'
arch=('any')
license=('GPL-2.0-or-later')
source=("https://pentestmonkey.net/tools/$pkgname/$pkgname-$pkgver.tar.gz"
        'Fix-missing-T-option-in-getopts-declaration.patch'
        'Fix-timeout-option-by-changing-it-to-w.patch'
        'fix-usage-output')
sha512sums=('dc33536957f54ec6d76d22d28d38c9653e06632cd87a94ed528692c38f31dd94f768765ce7539f69c072e0003f7769f009cf2f935823e1cdf31dfde1ca0dafcf'
            '81d801d8b172afaffec84b48da3ac9bc83e1e7c19cb16cc4bd9728445cbf332f20645edb4dfde74d24985c766d021b133556e42024fa11a1c215feac114b9c9b'
            '81f43eeb82f6c42c7a8016dfe957a48313afc630ae6d25bb5ab2d843d5bff27c7d2cf819fb476743f1f6915104238e72d7e23a7ce345e2a7477f09a7aaf87eea'
            'c2fa09b82a20903ff6b4bf1ea72e2991b2de4de93c68c5ced7626f54ef5ceda89e8b6a07d1045cadbc1776c7814455ab65c155e5fd93a4813ef0ca1789ad876d')

prepare() {
  cd "$pkgname-$pkgver"

  patch -p1 < ../Fix-timeout-option-by-changing-it-to-w.patch
  patch -p1 < ../Fix-missing-T-option-in-getopts-declaration.patch
  patch -p1 < ../fix-usage-output
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/doc/smtp-user-enum"

  install -Dm 755 "$pkgname.pl" "$pkgdir/usr/bin/$pkgname"
  install -m 644 CHANGELOG COPYING smtp-user-enum-user-docs.pdf \
    "$pkgdir/usr/share/doc/$pkgname"
}

